public class Thread_State  {

    public static void main(String[] args) throws InterruptedException{
        //匿名类 线程t1
        Thread t1 = new Thread(()->{
            for (int i = 0; i < 5; i++) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("/////");
        });
        //查看 新new 后的状态
        Thread.State  state = t1.getState();
        System.out.println(state);
        //查看启动后状态
        t1.start();
        state = t1.getState();
        System.out.println(state);

        while (state != Thread.State.TERMINATED){
            Thread.sleep(100);
            state = t1.getState();
            System.out.println(state);
        }

    }

}
